const emptyFn = () => {};

let oldLog: any = null;
export const suspendConsoleLog = () => {
  if (console.log === emptyFn) throw new Error("unbalanced suspending");
  oldLog = console.log;
  console.log = emptyFn;
};

export const resumeConsoleLog = () => {
  if (oldLog === null) throw new Error("unbalanced resuming");
  console.log = oldLog;
  oldLog = null;
};

export const tryResumeConsoleLog = () => {
  if (oldLog !== emptyFn && oldLog) {
    console.log = oldLog;
    oldLog = null;
  }
};

export * from "./task-chain";
